'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const ResumeFavorite = app.model.define('resume_favorite', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '收藏ID'
    },
    user_id: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 1,
      comment: '用户ID'
    },
    resume_id: {
      type: INTEGER,
      allowNull: true,
      comment: '简历ID（如果是创建的简历）'
    },
    pdf_resume_id: {
      type: INTEGER,
      allowNull: true,
      comment: 'PDF简历ID（如果是PDF简历）'
    },
    resume_name: {
      type: STRING(150),
      allowNull: false,
      comment: '简历名称'
    },
    template_id: {
      type: INTEGER,
      allowNull: true,
      comment: '模板ID（如果是创建的简历）'
    },
    pdf_url: {
      type: STRING(500),
      allowNull: true,
      comment: 'PDF地址（如果是PDF简历）'
    },
    resume_type: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 1,
      comment: '简历类型：1-创建的简历，2-PDF简历'
    }
  }, {
    tableName: 'resume_favorite',
    timestamps: true,
    underscored: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at'
  });

  return ResumeFavorite;
};

